package com.function.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.function.domin.pojo.Email;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface EmailMapper extends BaseMapper<Email> {

    /**
     * 将邮件信息插入user表
     * @param dbMessage
     */
    @Insert("insert into email(subject, `from`, `to`, post_time, text) " +
            "values (#{subject}, #{from}, #{to}, #{postTime}, #{text})")
    void insertEmail(Email dbMessage);

    /**
     * 找到最新的验证码
     * @return
     */
    @Select("select text from email order by post_time desc limit 1")
    String findLastEmailText();
}
